//
//  CollocationTableViewCell.m
//  Foodie_Talk_ProjectA
//
//  Created by Ming on 15-6-10.
//  Copyright (c) 2015年 蓝欧科技. All rights reserved.
//

#import "CollocationTableViewCell.h"
#import "BaseHeader.h"
#import "MenuSearchPage_Class.h"

@implementation CollocationTableViewCell
- (void)dealloc
{
    [_myLabel release];
    [_picLabel release];
    [_collocationClass release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.picLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.picLabel];
        [_picLabel release];
        
        self.myLabel = [[UILabel alloc] init];
        self.myLabel.numberOfLines = 0;
        [self.myLabel sizeToFit];
        [self.contentView addSubview:self.myLabel];
        [_myLabel release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.picLabel.frame = CGRectMake(20, 15, 30, 20);
    self.myLabel.frame = CGRectMake(60, 0, tableViewWidth - 60, tableViewHeight);
}
- (void)setCollocationClass:(MenuSearchPage_Class *)collocationClass
{
    if (_collocationClass != collocationClass) {
        [_collocationClass release];
        _collocationClass = [collocationClass retain];
    }
    self.picLabel.text = @"🈲";
    self.myLabel.text = [NSString stringWithFormat:@"%@ + %@: %@", self.collocationClass.ingreName1, self.collocationClass.ingreName2, self.collocationClass.content];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
